#!/bin/bash


mods=$1
version=$2

cd ~

rm ~/install.lock
touch ~/install.lock
echo "mods: $mods" >> ~/install.lock
echo `date +"%Y-%m-%d %H:%M:%S" ` '00% start' >> ~/install.lock
#rm -rf /azerothcore/modules/mod_*

echo `date +"%Y-%m-%d %H:%M:%S" ` '20% getSrc' >> ~/install.lock
#强制更新
cd /azerothcore
git fetch --all && git reset --hard origin/cn


echo `date +"%Y-%m-%d %H:%M:%S" ` '40% installMod' >> ~/install.lock

cd /azerothcore/modules
rm -rf ./mod-eluna
git clone https://gitee.com/53957105/mod-eluna-github.git --single-branch mod-eluna

###[modsClear]###

###[modsInstall]###

cd /azerothcore
./acore.sh db-assembler import-customs
echo `date +"%Y-%m-%d %H:%M:%S" ` '60% startBuild' >> ~/install.lock
./acore.sh install-deps && ./acore.sh compiler all

echo `date +"%Y-%m-%d %H:%M:%S" ` '80% setData' >> ~/install.lock

cp -f env/dist/etc/authserver.conf.dist env/dist/etc/authserver.conf
cp -f env/dist/etc/worldserver.conf.dist env/dist/etc/worldserver.conf

echo '[worldserver]'> env/dist/etc/worldserver.conf
echo 'SOAP.Enabled = 1'>> env/dist/etc/worldserver.conf
echo 'SOAP.IP = "0.0.0.0"'>> env/dist/etc/worldserver.conf

cd /azerothcore/env/dist/bin
unzip -oq ~/data.zip

echo `date +"%Y-%m-%d %H:%M:%S" ` '100% success' >> ~/install.lock
touch ~/install.lock

